package com.ezreal.picturebackend.api.imagesearch.s360;


import com.ezreal.picturebackend.api.imagesearch.s360.model.ImageSearchResult;
import com.ezreal.picturebackend.api.imagesearch.s360.sub.GetImageListApi;
import com.ezreal.picturebackend.api.imagesearch.s360.sub.GetImageUrlApi;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class ImageSearchApiFacade {

    /**
     * 搜索图片
     *
     * @param imageUrl 需要以图搜图的图片地址
     * @param start    开始下表
     * @return 图片搜索结果列表
     */
    public static List<ImageSearchResult> searchImage(String imageUrl, Integer start) {
        String soImageUrl = GetImageUrlApi.getSoImageUrl(imageUrl);
        List<ImageSearchResult> imageList = GetImageListApi.getImageList(soImageUrl, start);
        return imageList;
    }

    public static void main(String[] args) {
        // 测试以图搜图功能
        String imageUrl = "https://www.codefather.cn/logo.png";
        List<ImageSearchResult> resultList = searchImage(imageUrl, 1);
        System.out.println("结果列表" + resultList);
    }
}
